From: Ben Hutchings Date: Sat, 5 Mar 2016 23:22:10 +0000 (+0000) Subject: Revert "cgroup: make sure a parent css isn't offlined before its children" X-Git-Tag: archive/raspbian/4.9.13-1+rpi1~36 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com//styles.css/%22http:/www.example.com/styles.css?a=commitdiff_plain;h=cafc766e90ec63f04528e1d7d4b4faff57779fbf;p=linux-4.9.git Revert "cgroup: make sure a parent css isn't offlined before its children" This reverts commit 4cbd196324c05809338c7f118b6f374d3c2db7a0, which was commit aa226ff4a1ce79f229c6b7a4c0a14e17fececd01 upstream. It seems to be a good fix but causes an unfixable ABI change as it extends a structure that's embedded in other structures. Gbp-Pq: Topic debian Gbp-Pq: Name revert-cgroup-make-sure-a-parent-css-isn-t-offlined.patch --- diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h index 8e30faeab183..06b77f9dd3f2 100644 --- a/include/linux/cgroup-defs.h +++ b/include/linux/cgroup-defs.h @@ -133,12 +133,6 @@ struct cgroup_subsys_state { */ u64 serial_nr; - /* - * Incremented by online self and children. Used to guarantee that - * parents are not offlined before their children. - */ - atomic_t online_cnt; - /* percpu_ref killing and RCU release */ struct rcu_head rcu_head; struct work_struct destroy_work; diff --git a/kernel/cgroup.c b/kernel/cgroup.c index 8ffdbc1d94e8..580441117b1e 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -4784,7 +4784,6 @@ static void init_and_link_css(struct cgroup_subsys_state *css, INIT_LIST_HEAD(&css->sibling); INIT_LIST_HEAD(&css->children); css->serial_nr = css_serial_nr_next++; - atomic_set(&css->online_cnt, 0); if (cgroup_parent(cgrp)) { css->parent = cgroup_css(cgroup_parent(cgrp), ss); @@ -4807,10 +4806,6 @@ static int online_css(struct cgroup_subsys_state *css) if (!ret) { css->flags |= CSS_ONLINE; rcu_assign_pointer(css->cgroup->subsys[ss->id], css); - - atomic_inc(&css->online_cnt); - if (css->parent) - atomic_inc(&css->parent->online_cnt); } return ret; } @@ -5042,15 +5037,10 @@ static void css_killed_work_fn(struct work_struct *work) container_of(work, struct cgroup_subsys_state, destroy_work); mutex_lock(&cgroup_mutex); - - do { - offline_css(css); - css_put(css); - /* @css can't go away while we're holding cgroup_mutex */ - css = css->parent; - } while (css && atomic_dec_and_test(&css->online_cnt)); - + offline_css(css); mutex_unlock(&cgroup_mutex); + + css_put(css); } /* css kill confirmation processing requires process context, bounce */ @@ -5059,10 +5049,8 @@ static void css_killed_ref_fn(struct percpu_ref *ref) struct cgroup_subsys_state *css = container_of(ref, struct cgroup_subsys_state, refcnt); - if (atomic_dec_and_test(&css->online_cnt)) { - INIT_WORK(&css->destroy_work, css_killed_work_fn); - queue_work(cgroup_destroy_wq, &css->destroy_work); - } + INIT_WORK(&css->destroy_work, css_killed_work_fn); + queue_work(cgroup_destroy_wq, &css->destroy_work); } /**